<template>
  <continer>
    <template slot="search">
      <quickSearch :advForm="quickSearchForm" @QuickSearch="search"></quickSearch>
    </template>
    <template slot="oprate">
      <el-button type="primary" size="mini" @click="search">查询</el-button>
      <el-button size="mini" @click="addFun" v-if="isAdd">新增</el-button>
    </template>
    <template slot="content">
      <institutionTable ref="tableRef" class="instiutionTableBox"
        :pages="tablePages"
        :instiutionTableData="tableData"
        :instiutionTableHeader="tableHeader"
        :isShowPage="isShowPage"
        @sizeChange="sizeChange"
        @currentChange="currentChangeFun">
      </institutionTable>
    </template>
  </continer>
</template>
<script lang='ts'>
import { Component, Vue, Prop } from 'vue-property-decorator'
import continer from '@/common/views/configCommon/ui-modules/handle-wrapper.vue'
import quickSearch from '@/common/views/advancedSearch/QuickSearch.vue'
import institutionTable from '@/common/views/institutionTable/institutionTable.vue'
import styleAddOrEdit from '@/views/config/webchat/channel/pcAndWap/styleAddOrEdit.vue'
interface QuickSearchObj {
  form: {},
  advSearchOptions: {}
}
interface ArrayObj {
  props: string
}
@Component({
  name: 'accessTable',
  components: { continer, quickSearch, institutionTable, styleAddOrEdit }
})
export default class AccessTable extends Vue {
  @Prop(Object) public quickSearchForm!: QuickSearchObj // 表头
  @Prop(Array) public tableData!: ArrayObj[]
  @Prop(Array) public tableHeader!: ArrayObj[]
  @Prop(Object) public tablePages!: QuickSearchObj
  @Prop(Boolean) private isAdd!: boolean
  @Prop({ default: false }) private isShowOprate!: false
  @Prop({ default: true }) private isShowPage!: true
  private search () { // 搜索
    this.$emit('search')
  }

  private sizeChange (size: number) { // 翻页
    this.$emit('sizeChange', size)
  }

  private currentChangeFun (page: number) { // 选择当前页数
    this.$emit('currentChangeFun', page)
  }

  private addFun () { // 新增
    this.$emit('addFun')
  }
}
</script>
